home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3401 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: classic.iinet.com.au!news
  2. From: ng@mitswa.com.au (John A Ng)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Performance: C vs. C++
  5. Date: Tue, 23 Jan 1996 00:35:30 GMT
  6. Organization: MITS (WA)
  7. Message-ID: <4e26je$crd@classic.iinet.com.au>
  8. References: <30F6BAAC.12B5@iastate.edu>
  9. NNTP-Posting-Host: grunge205.nv.iinet.net.au
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. > >>C and C++ are so similar that I would expect similar code to produce 
  13. > >>almost identical performance. However, note that while virtual functions 
  14. > >>cause overhead when you use them, exceptions in most present compilers can 
  15. > >>cause overhead *at every function call*.
  16. David
  17.  
  18.  
  19. > >Not quite.  C is quite different from C++ from the performance point of
  20. > >view.  The difference is not only in virtual functions and exceptions
  21. > >but in class construction, destruction, etc... and most significantly in
  22. > >Runtime Type Checking.  However, because machines are getting faster by
  23. > >the day, this sort of "inefficiency" is hardly noticable.
  24. John Ng
  25.  
  26.  
  27. > Not quite. There are no such things as "virtual functions", "exceptions",
  28. > >"class construction", "destruction" and "Runtime Type Checking" in C.
  29. > If you use just "C" subset of C++ you will have the same efficiency as
  30. > for C (no more difference then with different "C" implementations).
  31. > I would not say if a new tool can do the same (with the same performance) and
  32. > something new (with some performance) than it has less performance.
  33. Michael Furman
  34.  
  35.  
  36. Conceded.  If you don't use C++ features in a C++ compiler, there 
  37. should be no difference in performance.  Then again, I don't see the 
  38. point in all this talk if we are still talking about using C in a C++ 
  39. compiler ? :-)
  40.  
  41. By the way, it should be "Runtime Type Information" instead of
  42. "Runtime Type Checking".
  43. Regards,
  44.  
  45. John Ng
  46. ng@mitswa.com.au
  47. Western Australia
  48.  
  49.